/**
 * <copyright>
 *
 * Copyright (c) 2011 Zeligsoft (2009) Limited
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: 
 *   Zeligsoft (2009) Limited - Initial API and implementation
 *
 * </copyright>
 *
 */
package org.omg.deployment.impl;

import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.omg.deployment.DeploymentPackage;
import org.omg.deployment.InstanceDeploymentDescription;
import org.omg.deployment.PlanSubcomponentPropertyReference;
import org.omg.xmi.impl.XMIImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Plan Subcomponent Property Reference</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.omg.deployment.impl.PlanSubcomponentPropertyReferenceImpl#getPropertyName <em>Property Name</em>}</li>
 *   <li>{@link org.omg.deployment.impl.PlanSubcomponentPropertyReferenceImpl#getInstance <em>Instance</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class PlanSubcomponentPropertyReferenceImpl extends XMIImpl implements
		PlanSubcomponentPropertyReference {
	/**
	 * The default value of the '{@link #getPropertyName() <em>Property Name</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPropertyName()
	 * @generated
	 * @ordered
	 */
	protected static final String PROPERTY_NAME_EDEFAULT = null;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected PlanSubcomponentPropertyReferenceImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return DeploymentPackage.eINSTANCE
				.getPlanSubcomponentPropertyReference();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getPropertyName() {
		return (String) getGroup()
				.get(DeploymentPackage.eINSTANCE
						.getPlanSubcomponentPropertyReference_PropertyName(),
						true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPropertyName(String newPropertyName) {
		((FeatureMap.Internal) getGroup()).set(DeploymentPackage.eINSTANCE
				.getPlanSubcomponentPropertyReference_PropertyName(),
				newPropertyName);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public InstanceDeploymentDescription getInstance() {
		return (InstanceDeploymentDescription) getGroup()
				.get(DeploymentPackage.eINSTANCE
						.getPlanSubcomponentPropertyReference_Instance(),
						true);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetInstance(
			InstanceDeploymentDescription newInstance, NotificationChain msgs) {
		return ((FeatureMap.Internal) getGroup()).basicAdd(
				DeploymentPackage.eINSTANCE
						.getPlanSubcomponentPropertyReference_Instance(),
				newInstance, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setInstance(InstanceDeploymentDescription newInstance) {
		((FeatureMap.Internal) getGroup()).set(DeploymentPackage.eINSTANCE
				.getPlanSubcomponentPropertyReference_Instance(), newInstance);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd,
			int featureID, NotificationChain msgs) {
		switch (featureID) {
		case DeploymentPackage.PLAN_SUBCOMPONENT_PROPERTY_REFERENCE__INSTANCE:
			return basicSetInstance(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
		case DeploymentPackage.PLAN_SUBCOMPONENT_PROPERTY_REFERENCE__PROPERTY_NAME:
			return getPropertyName();
		case DeploymentPackage.PLAN_SUBCOMPONENT_PROPERTY_REFERENCE__INSTANCE:
			return getInstance();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
		case DeploymentPackage.PLAN_SUBCOMPONENT_PROPERTY_REFERENCE__PROPERTY_NAME:
			setPropertyName((String) newValue);
			return;
		case DeploymentPackage.PLAN_SUBCOMPONENT_PROPERTY_REFERENCE__INSTANCE:
			setInstance((InstanceDeploymentDescription) newValue);
			return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
		case DeploymentPackage.PLAN_SUBCOMPONENT_PROPERTY_REFERENCE__PROPERTY_NAME:
			setPropertyName(PROPERTY_NAME_EDEFAULT);
			return;
		case DeploymentPackage.PLAN_SUBCOMPONENT_PROPERTY_REFERENCE__INSTANCE:
			setInstance((InstanceDeploymentDescription) null);
			return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
		case DeploymentPackage.PLAN_SUBCOMPONENT_PROPERTY_REFERENCE__PROPERTY_NAME:
			return PROPERTY_NAME_EDEFAULT == null ? getPropertyName() != null
					: !PROPERTY_NAME_EDEFAULT.equals(getPropertyName());
		case DeploymentPackage.PLAN_SUBCOMPONENT_PROPERTY_REFERENCE__INSTANCE:
			return getInstance() != null;
		}
		return super.eIsSet(featureID);
	}

} //PlanSubcomponentPropertyReferenceImpl
